home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
351-375
/
368
/
popmenu
/
popmenu_pak.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-14
|
6KB
|
140 lines
/***************************************************************************
* popmenu_pak.h -general-purpose dynamic Pop-up Menu routines to help make*
* programming alot easier. *
* (c) 1990 VIDEOWORKS Computer Applications *
* All rights reserved. *
* 129 Orchard Avenue, Rocky Mount, VA 24151 *
* (703) 483-8219 / 489-3863 *
* *
* Designed and Developed by Paul T. Miller *
* *
* Program Name: N/A *
* Version: 1 *
* Revision: 0 *
*-------------------------------------------------------------------------*
* File: (popmenu_pak.h) popmenu_pak.c header file *
*-------------------------------------------------------------------------*
* Modification History *
* Date Author Comment *
* -------- ------ ------- *
* 03-29-90 PTM Created. PMenu/PMenuItem structures and constants
*
***************************************************************************/
#ifndef POPMENU_PAK_H
#define POPMENU_PAK_H
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
#ifndef EXEC_MEMORY_H
#include <exec/memory.h>
#endif
#ifndef GRAPHICS_GFX_H
#include <graphics/gfx.h>
#endif
#ifndef INTUITION_INTUITION_H
#include <proto/intuition.h>
#endif
/* PMenu structure - based closely on Intuition Menu structure */
struct PMenu
{
struct PMenu *NextPMenu; /* next one in list */
struct Window *PMenuWindow; /* window this menu resides in */
SHORT LeftEdge; /* top-left corner of activate box */
SHORT TopEdge;
SHORT Width; /* width is user-set or based on items */
SHORT Height; /* height is user-set or based on font */
USHORT Flags; /* some status stuff */
SHORT pad; /* addresses should be long-word aligned */
UBYTE *MenuName; /* goes in activate box (for COMMPMENU) */
struct PMenuItem *FirstPItem; /* first item in list */
struct PMenuItem *ActiveItem; /* active item (the one displayed) */
struct Gadget *PMenuGadget; /* pointer to activate box gadget */
SHORT JazzX, JazzY, BeatX, BeatY; /* we can have mysterious stuff too...*/
};
/* FLAGS SET BY THE APPLIPROG */
#define LISTPMENU 0x1000 /* menu items are list only (w/ checks) */
#define COMMPMENU 0x2000 /* menu items are commands (only one) */
#define SHADOWED 0x0002 /* shadow the menu Mac-style */
#define TITLED 0x0008 /* user-controlled menu title */
/* SET BY POPUPMENU */
#define MENU_INIT 0x0004 /* has it been installed into a window? */
#define PREDEFINED 0x4000 /* PMenuItems were pre-defined */
/* The following flags are the same as in intuition.h, so we comment only.
#define MENUENABLED 0x0001 * whether or not this menu is enabled
FLAGS SET BY POPUPMENU
#define MIDRAWN 0x0100 * this menu's items are currently drawn
*/
/* PMenuItem structure - based loosely on Intuition MenuItem structure */
struct PMenuItem
{
struct PMenuItem *NextPItem; /* Next PMenuItem in list */
USHORT Flags; /* see below for details */
LONG MutualExclude; /* for LISTPMENU only */
APTR ItemFill; /* Only IntuiText supported right now */
APTR SelectFill; /* Currently not supported */
};
/* FLAGS SET BY THE APPLIPROG */
#define CENTERED 0x0004 /* center the menu text in the fields */
/* The following flags are the same as in intuition.h, so we comment only.
#define ITEMTEXT 0x0002 * set if textual, clear if graphical item *
#define ITEMENABLED 0x0010 * set if this item is enabled *
these are the SPECIAL HIGHLIGHT FLAG state meanings
#define HIGHFLAGS 0x00C0 * see definitions below for these bits *
#define HIGHIMAGE 0x0000 * use the user's "select image" *
#define HIGHCOMP 0x0040 * highlight by complementing the selectbox *
#define HIGHBOX 0x0080 * highlight by "boxing" the selectbox *
#define HIGHNONE 0x00C0 * don't highlight *
* FLAGS SET BY BOTH APPLIPROG AND POPMENU *
#define CHECKED 0x0100 * then set when selected/active *
*/
/* popmenu_pak.c function prototypes */
/* application callable routines */
struct PMenu *BuildPMenu(struct PMenuItem *, USHORT, SHORT, UBYTE *, USHORT);
void SetPMenuColor(struct PMenu *, USHORT, USHORT);
int InitPMenu(struct Window *, struct PMenu *, SHORT, SHORT);
void RemovePMenu(struct PMenu *);
void FreePMenu(struct PMenu *);
void SetActiveItem(struct PMenu *, SHORT);
struct PMenuItem *GetPItem(struct PMenu *, SHORT);
SHORT GetPItemNum(struct PMenu *, struct PMenuItem *);
int CountPMenuItems(struct PMenu *);
void SetPMenuText(struct PMenu *, UBYTE *);
void RefreshPMenu(struct PMenu *);
USHORT HandlePMenu(struct PMenu *);
/* support routines */
int find_maxpitemwidth(struct PMenu *);
void calc_border(struct PMenu *);
void calc_menusize(struct PMenu *);
struct BitMap *savebackground(struct PMenu *);
void restorebackground(struct PMenu *, struct BitMap *);
void drawpmenu(struct PMenu *);
struct PMenuItem *getmenuitem(struct PMenu *, SHORT, SHORT);
void handle_items(struct PMenu *, SHORT, SHORT, SHORT *);
void complement_item(struct PMenu *, SHORT);
struct BitMap *allocbitmap(USHORT, USHORT, UBYTE);
void freebitmap(struct BitMap *);
#endif /* POPMENU_PAK_H */